package cn.kgc.springcloud.client;

import cn.kgc.springcloud.entity.Role;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 课工场
 * @date 2024/10/16
 * @description    该接口中可以维护user服务向role服务发起请求接口
 *
 * RoleClient   伪http客户端  浏览器
 */
@FeignClient("ROLESERVICE")  //  localhost:8544/role/m1
public interface RoleClient {

    @RequestMapping("/role/m1")
    String method1();

    /*
    * http://localhost:8544/role/m2?id=1    queryString
    * http://localhost:8544/role/m2/1       path
    * */
    // http://localhost:8544/role/m2?id=1

    @GetMapping("/role/m2")
    String method2(@RequestParam("id") Integer id);

    @GetMapping("/role/m3/{id}")
    String method3(@PathVariable("id") Integer id);

 // http://localhost:8544/role/m4?id=1&roleName=root&description=管理员
    @GetMapping("/role/m4")
    String method4(@RequestParam("id") Integer id,@RequestParam("roleName") String roleName, @RequestParam("description") String description);

    // 参数以json格式进行传递
    @PostMapping("/role/m5")
    String method5(@RequestBody Role role);

    @PostMapping("/role/m6")
    String method6(@RequestBody String[] ids);

    // @PostMapping("/role/m7")
    // String method7();

    @PostMapping("/role/m7")
    Role method7();


    @PostMapping("/role/m8")
    List<Role> method8();
}
